var express = require('express');
var router = express.Router();
const {addSeating,getSeat,getSc}=require('../api/seating')



router.get('/', async function (req, res, next) {

  const data= await getSc()

      res.send(data)

  });

/**
 * @swagger
 * /seating/checkSeat:
 *    get:
 *      tags:
 *      - 选座模块         # 接口分类
 *      summary: 查询座位接口   # 接口备注
 *      description: 通过选座id查询座位序号  # 接口描述
 *      consumes:
 *      - "application/json"    # 接口接收参数类型
 *      parameters:
 *        - in: query
 *          name: seatingId
 *          schema:
 *            type: string
 *            default: 60dbcf1f7eee5f30e84deab3
 *          description: seatsId
 *      responses:  # 响应
 *        200:     # http状态码
 *          description: "选座数据获取成功！！！" # 返回 选座数据
 *          content:
 *            application/json:
 *              schema:
 *                $ref: '#/components/schemas/seating/checkSeat'
 * */
router.get('/checkSeat', async function (req, res, next) {

  const { seatingId}=req.query
  const data= await getSeat({seatingId})

      res.send(data)

  });

/**,
 * @swagger
 * /seating/addSeat:
 *    post:
 *      tags:
 *      - 选座模块          # 接口分类
 *      summary: 选座新增接口   # 接口备注
 *      description: 新增选座hao   # 接口描述
 *      consumes:
 *      - "application/json"    # 接口接收参数类型
 *      requestBody:
 *        required: true
 *        content:
 *          application/json:
 *            schema:
 *              $ref: '#/components/schemas/seating/addSeat'
 *      responses:  # 响应
 *        200:     # http状态码
 *          description: "成功"     # 返回 data
 *          content:
 *            application/json:
 *              schema:
 *                $ref: '#/components/schemas/seating/addSeat'
 * */
router.post('/addSeat', async function (req, res, next) {

  const { seatsId,scheduleId,a,status}=req.body
  
  const b=JSON.parse(a)
  const data= await addSeating({ seatsId,scheduleId,b,status})

      res.send(data)

  });
  
  
module.exports = router;
